﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class USupplerPartAddInput : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.新增 };
            }
        }
        protected override string DWZRef
        {
            get { return "USupplerPartList"; }
        }

        #region
        /// <summary>
        /// 需要修改的ID
        /// </summary>
        protected string ItemCode
        {
            get
            {
                return GetRequestValue<string>("ItemCode","");
            }
        }

        private USupplerPartInfo _obj;
        protected USupplerPartInfo obj
        {
            get
            {
                if (_obj == null)
                {
                    _obj=USupplerPartController.GetByItemCode(ItemCode);
                }
                return _obj;
                //OMenuController.ge
            }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "add")
            {
                addmenu();
            }

        }

        protected void addmenu()
        {
            USupplerPartInfo obx = Request.SerializableObject<USupplerPartInfo>();
            string remark = GetRequestValue<string>("Remark", "");

            if (USupplerPartController.AddInput(obx,remark)>0)
            {
                SuccessJson("添加成功", DWZRef);
            }
            else
                ErrorJson("添加失败", DWZRef);
        }
    }
}